<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$title}</title>
<JS href="../Public/js/jq.js" />
<script>
	$().ready(function() {
		$('#sel').change(function() {
			if ($(this).val() != '-1') {
				window.location.href = '__ACTION__/cid/' + $(this).val();
			}
		})

		$('#sel').attr('value', '{.cid}');

		$('#selectall').change(function() {
			if ($('#selectall').attr('checked') == true) {
				$('.ctl').attr('checked', 'checked');
			} else {
				$('.ctl').attr('checked', '');
			}
		})

	})
	function add() {
		if ($("#addtext").val() == '') {
			alert('请输入标题！');
			$("#addtext").focus();
		} else {
			name = $('#addtext').val();
		}
		$.post('__URL__/savesetting/', {
			'type' : '{.cid}',
			'name' : name
		}, function(data) {
			window.location.reload();

		})

	}

	function del() {
		arr = null;
		$('.ctl').each(function() {
			if ($(this).attr('checked') == true) {
				if (arr == null)
					arr = $(this).val();
				else
					arr += ',' + $(this).val();
			}
		})
		if (arr == null) {
			alert('未选择任何数据');
		} else {
			$.post('__URL__/deletesetting/',{
				'ids':arr
			},function(data){
				window.location.reload();
			})
		}

	}
</script>

</head>
<body>
<div class="setting"><select id="sel">
	<option value='-1''>请选择要设置的字段</option>
	<volist name="selects" id="s">
	<option value="{$key}">{$s}</option>
	</volist>
</select></div>

<present name='selectname'>
<div>
<p>{$selectname}</p>
<table border="1">
	<tr>
		<td>&nbsp;</td>
		<td>标题</td>
	</tr>
	<volist name="list" id="vo">
	<tr>
		<td><input type="checkbox" value="{$key}" name="ctl" class="ctl" /></td>
		<td>{$vo}</td>
	</tr>
	</volist>
</table>
<p>全选:<input type="checkbox" id="selectall" /> 选中项：<input
	type="button" onclick="del()" value="删除" /></p>
<p>标题：<input type="text" id="addtext" /> <input type="button"
	onclick="add()" value="添加" /></p>
</div>
</present>
</body>
</html>